<{include file="tpl/filter.tpl"}>
<{include file="tpl/grid.tpl"}>
<input type="hidden" value="<{$is_log}>" name="is_log" />
	
<script>
	var type = $("a.grid-tab").first().attr('data-type');
	var href = $("a.grid-tab").first().attr('href');
    $('input[name="r"]').val(type);
    $('input[name="r"]').attr("data-target",href);
    $("a.grid-tab").click(function(){
        var type = $(this).attr('data-type');
        var href = $(this).attr('href');
        $('input[name="r"]').val(type);
        $('input[name="r"]').attr("data-target",href);
        $("#ajax_search").click();
    });
    
    $("#ajax_search").click(function(){
    	var url = '?' + $("#filter-form").serialize();
        var target = $('input[name="r"]').attr("data-target");

        var conf = $('a[href="'+target+'"]').attr('data-config');
        config = $.parseJSON(conf);
        config.url = url;
        var json = JSON.stringify(config);
        $(target).grid(json);
    });
</script>